<!-- 这是活动报名页面 -->
<template>
  <div class="c-bg-sgray c-p">
    <header class="c-ph24 theme-bg-gradient18020 theme-fc c-pt30">
      <div class="c-ph16">
        <div class="c-flex-row c-aligni-center">
          <i class="iconfont icon-youhuiquan01 c-fs46 theme-fc"></i>
          <span class="c-fs32 c-fw-b c-pl20">{{rcdId ? '即将兑换的票券信息' : '您已选择票券'}}</span>
        </div>
        <div v-if="!rcdId" class="c-pt12 c-fs28">{{ticketName}}</div>
      </div>
      <section v-if="rcdId" class="c-ww592 c-bg-white c-ph24 c-pv24 c-br20 c-mt28">
        <div class="c-fs24 c-flex-row c-aligni-center c-justify-sb">
          <span class="c-fc-xblack">名称</span>
          <span class="c-fc-xblack c-fw-b">{{ticketItem.name}}</span>
        </div>
        <div class="c-mt16 c-fs24 c-flex-row c-aligni-center c-justify-sb">
          <span class="c-fc-xblack">数量</span>
          <span class="c-fc-xblack c-fw-b">{{selectNum}}</span>
        </div>
        <div class="c-mt16 c-fs24 c-flex-row c-aligni-center c-justify-sb">
          <span class="c-fc-xblack">价值</span>
          <span class="c-fc-xmlred c-fw-b"><span class="c-fs24">￥</span><span class="c-fs28">{{(Number(ticketItem.price) * selectNum).toFixed(2)}}</span></span>
        </div>
        <div v-if="ticketItem.desc" class="c-mt16 c-fs24 c-flex-row c-aligni-center c-justify-sb" @click="openTicketDesc">
          <span class="c-fc-xblack">票券说明</span>
          <span class="c-fs24 c-fc-gray">查看<i class="iconfont c-fs24 c-fc-gray">&#xe635;</i></span>
        </div>
      </section>
      <section v-else class="c-ww592 theme-bg-gradient180 c-br20 c-ph6 c-pb6 c-mt28">
        <div class="c-flex-row c-justify-sb c-aligni-center c-ph30 c-pv18 c-fc-white">
          <div class="c-fs32 c-fw-b">设置购票数量</div>
          <div class="c-fs20">注：{{min}}张起购，限购{{max}}张</div>
        </div>
        <div class="c-bg-white c-ph24 c-pv24 c-br20">
          <div class="c-flex-row c-aligni-center c-justify-sb">
            <span class="c-fs24 c-fc-xblack">选择数量</span>
            <shop-number
              :min="min"
              :max="max"
              :inputNum="defaultNum"
              @subNum="changeNum"
              @addNum="changeNum"
              @inputChange="changeNum"
            ></shop-number>
          </div>
          <div class="c-mt12 c-fs24 c-flex-row c-aligni-center c-justify-sb">
            <span class="c-fc-xblack">费用</span>
            <span class="c-fc-xmlred c-fw-b"><span class="c-fs24">￥</span><span class="c-fs28">{{(selectPrice * selectNum).toFixed(2)}}</span></span>
          </div>
        </div>

      </section>
    </header>

    <section v-if="enableCustomerForm == 1 && formData && formData.length" class="c-ph24 c-pb20 c-pt42">
      <div class="c-fs26 c-fw-b">填写报名人信息</div>
      <EnrollForm :formData="formData" :currentFormData="currentFormData" :selectedList="selectedList" :isCollectForm="isCollectForm" />
    </section>
    <footer class="c-pf c-p-b0 c-p-l0 c-w100 c-hh100 c-flex-row c-flex-center footer-btn-box">
      <div @click="submitForm" class="c-ww592 c-hh64 c-br32 c-flex-row c-flex-center c-fc-white c-fs28 theme-bg">确定</div>
    </footer>
  </div>
</template>
<script>
import ShopNumber from "@/components/templates/shopNumber.vue";
import EnrollForm from "@/components/templates/activity/enrollForm.vue";
import { utilJs } from "@/utils/common.js";
let isClick = false;
let isLoading = false;
export default {
  name: "ActivityEnroll",
  components: {
    ShopNumber,
    EnrollForm
  },
  data() {
    return {
      defaultNum:1,
      selectNum:1,
      selectPrice:0,
      min: 1,
      max: 1,
      ticketId: null,
      isFree: null, // 是否付0元 0 是 1 不是
      isAudit: null, // 是否要审核 0 不审核 1 要审核
      formData: [], // 要填哪些字段
      currentFormData: [], // 要填哪些字段
      selectedList:[],
      poster: "", // 活动海报
      activityName: "",
      enrollStartAt: "",
      enrollEndAt: "",
      activityId: null,
      name: "", // 姓名
      mobile: null, // 手机号
      career: "", // 职业
      tips: "", // 备注
      groupId: -1,
      collageId: -1,
      pId: -1,
      infoData: {}, // 基本信息 活动的 约课场次的
      hasFormSet: false,
      isCollectForm: 0,
      identCode: '',
      submitData: "",
      collageGroupType: 1, //默认普通拼团
      stepIndex: '',
      collagePriceIndex: -1,
      selectId: -1,
      enableCustomerForm: 1, // 是否开启自定义表单：1=开启；-1=关闭',
      collectPage: '', // collectPage 3 选填时就不需要跳转到关联表单页
      isAutoFill: 1, // 是否自动填写表单信息
      rcdId: '', // 兑换票券跳转过来的兑换券id
      ticketItem: {},
      mtkType: 0,
      vipType: 1, // 用户身份
    };
  },
  filters: {
    timeFilter(val) {
      if (!val) {
        return ''
      } else {
        return val.substr(0, 16)
      }
    }
  },
  created() {
    utilJs.appShare(this);
  },
  watch: {
  },
  methods: {
    openTicketDesc() {
      this.$cjConfirm({
        title: '票券说明',
        message: this.ticketItem.desc,
        showCancelButton:false,
        confirmButtonText:'知道了'
      })
    },
    getVipPrice(selectItem = {}) {
      if (this.vipType == 2) {
        let vipPrice = selectItem.vipDiscountType && selectItem.vipDiscountType == 2 ? selectItem.vipDiscountPrice : selectItem.vipDiscount * 0.01 * selectItem.price;
        return (vipPrice * 1).toFixed(2);
      }
      if (this.vipType == 4) {
        let vipPrice = selectItem.vipDiscountType && selectItem.vipDiscountType == 2 ? selectItem.svipDiscountPrice : selectItem.svipDiscount * 0.01 * selectItem.price;
        return (vipPrice * 1).toFixed(2);
      }
      if (this.vipType != 1 && selectItem.commonProdInfo.agentDiscount != 100) {
        let vipPrice = selectItem.commonProdInfo.agentDiscount * 0.01 * selectItem.price;
        return (vipPrice * 1).toFixed(2);
      }
      return selectItem.price
    },
    getIsFree(item = {}) {
      //免费票
      if (item.permission == 19) {
        return 0
      }
      //指定组织架构成员免费
      if (item.isDepartments == 1 && item.isUserInDepartment == 1) {
        return 0
      }
      //vip免费
      if (this.vipType == 2 && item.vipDiscount == 0) {
        return 0
      }
      //svip免费
      if (this.vipType == 4 && item.svipDiscount == 0) {
        return 0
      }
       //服务商免费
      if ((this.vipType == 3 || this.vipType >= 5) && item.commonProdInfo.agentDiscount == 0) {
        return 0
      }
      return 1
    },
    getActivityBills() {
      let data = {
        activityId: this.activityId,
        collageId: this.collageId,
        groupId:this.groupId,
      }
      utilJs.postMethod(`${global.apiurl}activities/mgticket`, data, res => {
        const list = res.data || []
        this.ticketItem = list.filter(i => i.prodId == this.ticketId && i.mtkType == this.mtkType)[0] || {}
        this.vipType = res.retUserType; // 会员身份
        this.isFree = this.getIsFree(this.ticketItem);
        this.isAudit = this.ticketItem.isAudit == 1 ? 1 : 0; //是否要审核 0 不审核 1审核
        this.ticketName = this.ticketItem.name || "";
        this.min = this.ticketItem.least || 1;
        this.max = Math.min(this.ticketItem.number1, this.ticketItem.most) || 1;
        this.defaultNum = this.$route.query.selectNum || this.min;
        this.selectNum = this.$route.query.selectNum || this.min;
        this.selectPrice = this.getVipPrice(this.ticketItem);
        if (this.recType == 3) {
          this.selectPrice = this.ticketItem.recommend.action.recommendPrice;
        }
        if (this.ticketItem.isDepartments == 1 && this.ticketItem.isUserInDepartment == 1) {
          this.selectPrice = 0;
        }
        const optimal = this.ticketItem.optimal
        // 限时折扣
        const sales = this.ticketItem.sales
        if (this.mtkType == 1 && (!optimal || (optimal && optimal.optimalPriceType == 101)) && sales && sales.sales.status == 2 && (sales.limit == 0 || sales.balance > 0)) {
          this.selectPrice = sales.price;
          this.pId = sales.pId;
          return
        }
        // 砍价
        const bargain = this.ticketItem.bargain
        if ((!optimal || (optimal && optimal.optimalPriceType == 112)) && this.mtkType == 12 && bargain && (bargain.status == 2 || (bargain.isPreheat == 1 && bargain.status == 1))) {
          this.bargainId = bargain.bargainId;
          this.attendNo = bargain.attendNo;
          this.selectPrice = bargain.reservePrice;
          return
        }
        // 拼团
        const collage = this.ticketItem.collage
        if ((!optimal || (optimal && optimal.optimalPriceType == 102)) && this.isFree == 1 && this.mtkType == 2 && collage && collage.status == 2 && collage.collageId > 0) {
          this.isFree = this.groupId == -1 && collage.userType == -1 ? (Number(collage.captainPrice) == 0 ? 0 : 1) : this.isFree;
          // 判断什么类型拼团取价格
          let leaderPrice = collage.captainPrice;
          if (collage.collageGroupType == 2 && collage.captainPriceType == 2) {
            collage.collageGrades.forEach((val, index) => {
              if (index == this.collagePriceIndex) {
                leaderPrice = val.captainPrice;
              }
            });
          }
          if (this.groupId != -1 && this.selectId == this.ticketItem.atId) {
            leaderPrice = collage.playersPrice;
          }
          this.selectPrice = leaderPrice;
          this.collageGroupType = collage.collageGroupType; //当前属于什么拼团类型
          this.stepIndex = this.collagePriceIndex > -1 ? collage.collageGrades[this.collagePriceIndex].index : '';
        }
      }, failRes => {
        this.isShowSelectBill = false;
        window.history.length > 1 ? this.$router.go(-1) : this.$routerGo(this, "replace", { path: '/' });
      })
    },
     //数量增加 || 减少 || 输入数量
    changeNum(item) {
      this.selectNum = item.inputNumber;
      if (!this.sourceFormData) {
        return;
      }
      if (this.sourceFormData && !this.sourceFormData.length) {
        return;
      }
      this.resetFormData();
    },
    checkRules(i, data) {
      let personNum = this.currentFormData.length; // 需要填写几人的信息
      let value = data['value' + i];
      if ((data.dataType == 6 || data.dataType == 7 || data.dataType == 12) && data['value' + i]) {
        value = data['value' + i].join('')
      }
      // 必填 && 显示 （省市区还需要额外判断详细地址有没有填
      if (((data.dataType != 7 && !value) || (data.dataType == 7 && (!value || !data.addressDetail)) || (data.dataType == 999 && (!value || value.length == 0))) && data.isReq == 1 && data.enabled == 1) {
        this.$showCjToast({
          text: personNum > 1 ? `请完整填写第${i + 1}位信息` : `请完整填写信息`,
          type: "warn",
        });
        return false
      }
      if ((data.dataType == 10 && !utilJs.isPhoneNumber(data['value' + i])) && data.isReq == 1 && data.enabled == 1) {
        this.$showCjToast({
          text: personNum > 1 ? `请填写第${i + 1}位正确的手机号` : `请填写正确的手机号`,
          type: "warn",
        });
        return false;
      }
      return true;
    },
    // 改版提交
    submitForm() {

      let data = JSON.parse(JSON.stringify(this.currentFormData))
      for (let i = 0; i < data.length; i++) {
        for (let j = 0; j < data[i].fieldVal.length; j++) {
          if (data[i].fieldVal[j].isSystemField == 1 && data[i].fieldVal[j].dataType == 1 && !this.isFromPromotedAccount) {// 姓名
            data[i].name = data[i].fieldVal[j]['value' + i]
          }
          if (data[i].fieldVal[j].isSystemField == 1 && data[i].fieldVal[j].dataType == 10 && !this.isFromPromotedAccount) {// 手机号
            data[i].mobile = data[i].fieldVal[j]['value' + i]
          }
          if (data[i].fieldVal[j].dataType == 8 || data[i].fieldVal[j].dataType == 13) {
            data[i].fieldVal[j]['value' + i] = data[i].fieldVal[j]['value' + i][0]
          }
          if (!this.checkRules(i, data[i].fieldVal[j])) {
            return
          }
          if (data[i].fieldVal[j].dataType == 5 && data[i].fieldVal[j]['value' + i]) {
            data[i].fieldVal[j]['value' + i] = Number(data[i].fieldVal[j]['value' + i])
          }
          // 省市区+详细地址格式 {id: [], name: [], addressDetail: '详细地址'}
          if (data[i].fieldVal[j].dataType == 7 && data[i].fieldVal[j]['value' + i] && data[i].fieldVal[j]['value' + i].length > 0) {
            let nameList = []
            data[i].fieldVal[j]['value' + i].forEach((item, index) => {
              nameList.push(this.selectedList[item])
            })
            data[i].fieldVal[j]['value' + i] = {
              id: data[i].fieldVal[j]['value' + i],
              name: nameList,
              addressDetail: data[i].fieldVal[j].addressDetail
            };
            delete data[i].fieldVal[j].addressDetail
          }
          data[i].fieldVal[j]['value'] = data[i].fieldVal[j]['value' + i]
          delete data[i].fieldVal[j]['value' + i]
        }
      }
      if (isClick) {
        return;
      }
      isClick = true;
      this.submitActivity(data)
    },
    setMobileActivityEnroll(orderId, issuccess = 1) {
      const data = {
        id: -1,
        activityId: this.activityId,
        actTicketId: this.ticketId,
        orderId: orderId || -1,
        opType: 1, //【1：报名，6：支付完修改报名状态】
        issuccess: issuccess, //报名状态 免费票：1；收费票：未支付传2，已支付传1
        identCode: this.identCode, //每单传的识别码（encodeUserId + 时间戳）
        infoArr: this.submitData, //报名信息
        number: this.selectNum, //购买票数
        isFreeOrder: 1, // 1:是免费 0 :收费  后端需要根据这个参数，插入免费订单信息，不然之前免费是没走订单流程的
      }
      if (this.rcdId) {
        data.rcdId = this.rcdId // 标识是走兑换券兑换活动票券的流程
      }
      // 邀请榜 推荐人id
      if (!this.rcdId && this.$route.query.refereeId) {
        data.inviteUserId = this.$route.query.refereeId
      }

      utilJs.postMethod(global.apiurl + "activities/setMobileActivityEnroll", data, (res) => {
        isClick = false;
        // reterror -1：系统报错，0：成功，3：报过名，2：错误
        if (res.retError == 0 && this.isFree == 0 && this.collageId != -1) {
          this.$showCjToast({text: "成功参加拼团", type: "success", time: 3000});
          const hasFormSet = (this.hasFormSet && localStorage.getItem("showForm") == 1) ? 1 : 0;
          let queryT = hasFormSet == 1 ? { groupId: this.groupId, collageId: this.collageId, activityNo: this.activityId, hasFormSet: 1 } : { groupId: this.groupId, collageId: this.collageId }
          this.$routerGo(this, "replace", {
            path: `/homePage/collage/collageDetail`,
            query: queryT
          });
          return
        }
        if (res.retError == 0) {
          // 支付0元直接报名成功，不跳转支付页面
          this.$showCjToast({text: "报名成功", type: "success", time: 3000});
          let isNeedAudit = this.ticketItem.isAudit == 1 ? 2 : 1;
          let hasFormSet = (this.hasFormSet && localStorage.getItem("showForm") == 1) ? 1 : 0;
          let goPath = `/activity/activitySuccess?activityNo=${this.activityId}&from=${isNeedAudit}&hasFormSet=${hasFormSet}&identCode=${this.identCode}&collectPage=${this.collectPage}`;
          this.$routerGo(this, "replace", {
            path: goPath
          });
        }
        if (res.retError == 2) {
          this.$showCjToast({text: res.msg, type: "warn", time: 1500});
        }
        if (res.retError == 2 && !this.rcdId) {
          this.$routerGo(this, "replace", {
            path: `/activity/activityDetail`,
            query: { ActivityNo: this.activityId }
          });
        }
      }, () => {
        isClick = false;
      });
    },
    confirmExchange() {
      if (isLoading) {
        return;
      }
      isLoading = true;
      let postUrl = `${global.apiurl}redeemCodes/selectProdToRedeem/${this.rcdId}`;
      utilJs.postMethod(postUrl, {prodId: this.activityId, subId: this.ticketId, prodType: global.ckFrom.activity}, res => {
        const orderId = res && res.orderId ? res.orderId : -1
        this.setMobileActivityEnroll(orderId)
        isLoading = false;
      }, failRes => {
        isLoading = false;
      })
    },
    checkFreeOpenGroup() {
      utilJs.postMethod( global.apiurl + "collage/freeOpenGroup", { collageId: this.collageId }, (response) => {
        const orderId = response.orderId
        this.setMobileActivityEnroll(orderId, -2)
      }, (res) => {
        this.$showCjToast({text: "参加拼团失败", type: "warn", time: 3000});
        isClick = false;
      }
    );
    },
    // 提交
    submitActivity(submitData) {
      for (let i of submitData) {
        i.fieldVal = JSON.stringify(i.fieldVal)
      }
      this.submitData = submitData;

      // 票券兑换跳转过来的，直接走兑换流程
      if (this.rcdId) {
        this.confirmExchange()
        return
      }
      // 免费券
      if (this.isFree == 0 && this.collageId == -1) {
        const issuccess = this.isAudit == 1 && this.isFree == 0 ? 0 : 1;
        this.setMobileActivityEnroll(-1, issuccess)
        return
      }
      // 拼团团长免费(现在好像团长价只能最低0.01？)
      if (this.isFree == 0 && this.collageId != -1) {
        this.checkFreeOpenGroup()
        return
      }
      const activityEnrollInfo = {
        activityId: this.activityId,
        actTicketId: this.ticketId,
        infoArr: this.submitData,
        identCode: this.identCode
      }
      //跳转至支付页面
      localStorage.setItem( "activityEnrollInfo", JSON.stringify(activityEnrollInfo));
      // 砍价购
      if (this.bargainId) {
        this.$routerGo(this, "replace", {
          path: "/homePage/bargain/bargainDetail",
          query: {
            bargainId: this.bargainId,
            number: this.selectNum,
            ckFrom: global.ckFrom.activity,
            attendNo: this.attendNo,
            refereeId: this.$route.query.refereeId ? this.$route.query.refereeId : ''
          }
        });
        return;
      }
      const queryInfo = {
        cId: this.collageId != -1 ? this.groupId : -1,
        extId: this.collageId != -1 ? this.collageId : this.ticketId,
        ckFrom: this.collageId != -1 ? global.ckFrom.collageActivity : this.pId ? global.ckFrom.flashSalesActivity : global.ckFrom.activity, // 活动进入支付页面
        isFromInvite: 0,
        hasFormSet: this.hasFormSet ? 1 : 0, //支付完成后是否需要跳转到表单
        recType: this.$route.query.recType, // 推荐有礼，支付的，传值过去cou
        recRelateId: this.$route.query.recRelateId,
        selectNum: this.selectNum,
        activityId: this.activityId,
        collectPage:this.collectPage
      }
      if (this.collageId != -1) {
        queryInfo.prodId = this.ticketId
      }
      if (this.$route.query.refereeId) {
        queryInfo.refereeId = this.$route.query.refereeId;
      }
      if (this.goodsRoomId) {
        queryInfo.goodsRoomId = this.goodsRoomId;
      }
      if (this.pId) {
        queryInfo.pId = this.pId;
      }
      if (this.collageGroupType == 2) {
        queryInfo.stepIndex = this.stepIndex;
      }
      this.$routerGo(this, "replace", {
        path: `/homePage/course/coursePay`,
        query: queryInfo
      });
    },
    // 获取活动信息
    getActivityInfo() {
      let $this = this;
      utilJs.postMethod(`${global.apiurl}activities/getMobileActivityBaseInfo`,
        { activityId: this.activityId },
        function (res) {
          $this.identCode = `${localStorage.getItem("userId")}${new Date().getTime()}`
          // 获取活动信息
          $this.poster = res.data[0].poster;
          $this.activityName = res.data[0].name;
          $this.enrollStartAt = res.data[0].enrollStartAt.substr(5, 11);
          $this.enrollEndAt = res.data[0].enrollEndAt.substr(5, 11);
          $this.hasFormSet = res.data[0].isRelForm && !res.data[0].hasFormLog;
          $this.isCollectForm = res.data[0].isCollectForm;
          $this.enableCustomerForm = res.data[0].enableCustomerForm
          $this.collectPage = res.data[0].collectPage || '';
          $this.isAutoFill = res.data[0].isAutoFill || 1;
          setDocumentTitle($this.enableCustomerForm == 1 ? "填写信息" : '确认信息');
          $this.getEnrollForm();
        }
      );
    },
    // 获取报名表单信息
    getEnrollForm() {
      utilJs.postMethod(`${global.apiurl}activities/mgenrollfield`,
        { activityId: this.activityId }, (res) => {
          if (!res.data) {
            return
          }
          // 获取报名表单信息
          this.sourceFormData = res.data;
          this.resetFormData();

        }
      );
    },
    resetFormData() {
        let num = this.isCollectForm == 1 ? this.selectNum : 1;
          let name = '';
          let mobile = '';
          if (this.isAutoFill == 1) {
            name = localStorage.getItem('realName') || localStorage.getItem('userName') || '';
            mobile = localStorage.getItem('uMobile') || '';
          }
          let berforeData = utilJs.deepCopy(this.currentFormData);
          this.formData = [];
          //这么做是为了防止每次+-数量的时候重置了整个表单导致已填的数据都没了需要重新填
          //已填表单数量 >= 当前票的数量，则直接截取已填表单数量的前num个
          if (berforeData.length >= num) {
             this.formData = berforeData.splice(0, num);
          } else {
            //已填表单数量 < 当前票的数量，则需要再添加num-已填表单数量个 表单数据
            this.formData = utilJs.deepCopy(berforeData);
            for (let i = 0; i < num - berforeData.length ; i++) {
              this.formData.push({
                name: name,
                mobile: mobile,
                fieldVal: this.enableCustomerForm == 1 ? [...this.sourceFormData] : []
              })
            }
          }

          let copyData = JSON.parse(JSON.stringify(this.formData));

          copyData.forEach((item, index) => {
            item.isShowAll = true;
            item.fieldVal.forEach((fItem, fIndex) => {
              // eslint-disable-next-line no-debugger
              let valueNum = copyData[index].fieldVal[fIndex][`value${index}`];
              copyData[index].fieldVal[fIndex][`value${index}`] = valueNum || copyData[index].fieldVal[fIndex].value;
              if ((fItem.dataType == 6 || fItem.dataType == 7 || fItem.dataType == 8 || fItem.dataType == 13 || fItem.dataType == 12 || fItem.dataType == 999) && !fItem['value' + index]) {
                copyData[index].fieldVal[fIndex][`value${index}`] = valueNum || []
                copyData[index].fieldVal[fIndex]['value'] = copyData[index].fieldVal[fIndex]['value'] || []
              }
              if (fItem.dataType == 7) { // 省市区多添加详细地址的值
                copyData[index].fieldVal[fIndex].addressDetail = copyData[index].fieldVal[fIndex].addressDetail || ''
              }
              if (fItem.isSystemField == 1 && fItem.dataType == 1) { // 判断是系统字段的姓名需要自动填充
                copyData[index].fieldVal[fIndex][`value${index}`] = valueNum || copyData[index].name
                copyData[index].fieldVal[fIndex]['value'] = copyData[index].fieldVal[fIndex]['value'] || copyData[index].name
              }
              if (fItem.isSystemField == 1 && fItem.dataType == 10) { // 判断是系统字段的手机号需要自动填充
                copyData[index].fieldVal[fIndex][`value${index}`] = valueNum || copyData[index].mobile
                copyData[index].fieldVal[fIndex]['value'] = copyData[index].fieldVal[fIndex]['value'] || copyData[index].mobile
              }
            })
          })
          this.currentFormData = copyData;
          this.selectedList = [];
    },
    //分享
    wechatShare: function () {
      utilJs.wechatConfig("", "", "", "", function () { }, true);
    },
    //手机端分享
    appShare: function () {
      utilJs.appShareTrue("", "", "", "");
    },
  },
  activated() {
    setDocumentTitle("填写信息");// eslint-disable-line
    isClick = false;
    isLoading = false;
    this.formData = [];
     this.currentFormData = [];
    this.groupId = this.$route.query.groupId ? this.$route.query.groupId : -1;
    this.collageId = this.$route.query.collageId ? this.$route.query.collageId : -1;
    this.selectId = this.$route.query.selectId || -1;
    this.pId = this.$route.query.pId ? this.$route.query.pId : "";
    this.bargainId = this.$route.query.bargainId || '';
    this.attendNo = this.$route.query.attendNo || '';
    this.ticketId = this.$route.query.ticketId;
    this.activityId = this.$route.query.activityId;
    this.goodsRoomId = this.$route.query.goodsRoomId || '';
    this.collageGroupType = this.$route.query.collageGroupType || 1;
    this.stepIndex = this.$route.query.stepIndex || '';
    this.collagePriceIndex = this.$route.query.collagePriceIndex || -1;
    this.selectNum = 1;
    this.isCollectForm = 0;
    this.submitData = "";
    this.enableCustomerForm = 1;
    this.collectPage = ''
    this.isAutoFill = 1;
    this.rcdId = this.$route.query.rcdId || '';
    this.mtkType = this.$route.query.mtkType || 0;
    this.ticketItem = {}
    this.getActivityInfo();
    this.wechatShare();
    this.getActivityBills()
  },
  deactivated() {
    this.name = "";
    this.mobile = "";
    this.poster = '';
  }
};
</script>
<style scoped>
.footer-btn-box{
  background: #fff;
  box-shadow: 0 -2px 8px 0 rgba(0, 0, 0, 0.05);
}
</style>


